package com.zmn.oms.dubbo.interfaces.zmn.normal.order;


import com.zmn.common.dto2.ResponseDTO;
import com.zmn.oms.common.dio.normal.order.PageByCheckoutTimeDIO;
import com.zmn.oms.common.dio.normal.order.PageByCompleteTimeDIO;
import com.zmn.oms.common.dro.order.CheckoutedOrder;
import com.zmn.oms.common.dro.order.CompletedOrder;
import com.zmn.oms.common.dro.order.MasterOrderWorkDRO;
import com.zmn.oms.dubbo.dto.zmn.order.OrderWorkDRO;
import com.zmn.oms.dubbo.dto.zmn.order.OrderWorkDetailSpoolDRO;
import com.zmn.oms.dubbo.dto.zmn.order.OrderWorkInfoDRO;
import com.zmn.oms.dubbo.dto.zmn.order.sourcechannel.SourceChannelOrderPageDRO;
import com.zmn.oms.dubbo.dto.zmn.order.sourcechannel.SourceChannelOrderQueryDIO;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;

import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Positive;
import java.util.Date;
import java.util.List;
import java.util.Map;

/**
 * 类描述：普通单查询
 *
 * @author liuying
 * @date 2019/04/09 15:02
 */
public interface ZsNormalOrderListRemoteService {

	/**
	 * 通过工单id查询
	 *
	 * @param workId
	 * @param orderId
	 * @return
	 */
	ResponseDTO<OrderWorkDRO> getOrderWorkByKey(@NotNull Long workId, @NotNull Long orderId);

	/**
	 * 通过工单id查询（跟单系统使用）
	 *
	 * @param workId
	 * @param orderId
	 * @return
	 */
	@ApiOperation(value = "根据工单id和订单id查询工单信息", response = ResponseDTO.class)
	ResponseDTO<OrderWorkInfoDRO> getOrderWorkInfoToTrackWorkByKey(@ApiParam(value = "工单id", required = true)
	                                                               @NotNull(message = "工单id不能传空") Long workId,
	                                                               @ApiParam(value = "订单id", required = true)
	                                                               @NotNull(message = "订单id不能传空") Long orderId);

	/**
	 * 根据ID查询 精简
	 * @param workId
	 * @param orderId
	 * @return
	 */
	@ApiOperation(value = "根据工单id和订单id查询工单信息", response = ResponseDTO.class)
	ResponseDTO<OrderWorkDRO> getSimpleOrderWorkInfoByKey(@ApiParam(value = "工单id", required = true)
														  @NotNull(message = "工单id不能传空") Long workId,
														  @ApiParam(value = "订单id", required = true)
														  @NotNull(message = "订单id不能传空") Long orderId);

	/**
	 * 通过工单id和工单类型查询退款返修单
	 *
	 * @param orderId 订单号
	 * @param type    订单类型：1 新单、2 返修单 3 退款单 com.zmn.oms.common.constant.OrderConsts#ORDER_TYPE_REFUND
	 * @return
	 */
	ResponseDTO<List<OrderWorkDRO>> listOrderWorkByOrderIdAndType(@NotNull Long orderId, @NotNull Integer type);

	/**
	 * 分页查询来源渠道订单
	 *
	 * @param query
	 * @return
	 */
	ResponseDTO<SourceChannelOrderPageDRO> listPageSourceChannelOrderByQuery(SourceChannelOrderQueryDIO query);

	/**
	 * 通过订单id集合查询
	 *
	 * @param orderIdList
	 * @return
	 */
	ResponseDTO<Map<Long, OrderWorkDRO>> listOrderWorkByWorkIdList(@NotEmpty List<Long> orderIdList);

	/**
	 * 查询24小时内手机号的下单渠道
	 *
	 * @param mobile
	 * @return
	 */
	ResponseDTO<List<Integer>> listChannelIdTwentyFourByMobile(@NotNull String mobile);


	/**
	 * 获取用户最近一个派单时间工单时间轴详情
	 *
	 * @param userId
	 * @return
	 */
	ResponseDTO<OrderWorkDetailSpoolDRO> getRecentOneOrderIdByUserId(Long userId);

	/**
	 * 获取工单时间轴详情
	 * 产品需求变动，生命周期节点变动
	 *
	 * @param workId
	 * @param orderId
	 * @return
	 * @see ZsNormalOrderNodeSpoolRemoteService#listOrderNodeSpoolById(java.lang.Long, java.lang.Long)
	 */
	@Deprecated
	ResponseDTO<List<OrderWorkDetailSpoolDRO>> listOrderDetailSpoolById(@NotNull Long workId, @NotNull Long orderId);

	/**
	 * 获取工程师已完成工单
	 *
	 * @param startTime 开始时间（完成时间）
	 * @param endTime   结束时间（完成时间）
	 * @param masterId  工程师id
	 * @return * @return 最大返回1000条
	 */
	@ApiOperation(value = "获取工程师已完成工单", response = ResponseDTO.class)
	ResponseDTO<List<CompletedOrder>> listCompletedOrderByMasterId(@NotNull @ApiParam(value = "开始时间", required = true) Date startTime,
	                                                               @NotNull @ApiParam(value = "结束时间", required = true) Date endTime,
	                                                               @NotNull @Positive @ApiParam(value = "工程师id", required = true) Integer masterId);

	/**
	 * 获取工程师已收单工单
	 *
	 * @param startTime 开始时间（完成时间）
	 * @param endTime   结束时间（完成时间）
	 * @param masterId  工程师id
	 * @return 最大返回1000条
	 * @author liudi
	 */
	@ApiOperation(value = "获取工程师已收单工单", response = ResponseDTO.class)
	ResponseDTO<List<CheckoutedOrder>> listCheckoutedOrderByMasterId(@NotNull @ApiParam(value = "开始时间", required = true) Date startTime,
	                                                                 @NotNull @ApiParam(value = "结束时间", required = true) Date endTime,
	                                                                 @NotNull @Positive @ApiParam(value = "工程师id", required = true) Integer masterId);

	/**
	 *
	 * 按完成时间获取订单
	 * @return 最大返回1000条
	 * @author heciqi
	 */
	@ApiOperation(value = "按完成时间获取订单", response = ResponseDTO.class)
	ResponseDTO<List<MasterOrderWorkDRO>> listPageByCompleteTime(@NotNull @ApiParam(value = "开始时间", required = true)
																		 PageByCompleteTimeDIO pageDIO);
	/**
	 *
	 * 按收单时间获取订单
	 * @return 最大返回1000条
	 * @author heciqi
	 */
	@ApiOperation(value = "按收单时间获取订单", response = ResponseDTO.class)
	ResponseDTO<List<MasterOrderWorkDRO>> listPageByCheckoutTime(@NotNull @ApiParam(value = "入参", required = true)
																		 PageByCheckoutTimeDIO pageDIO);
}